package gsutil

import (
	"os"
	"path/filepath"
	"strings"
)

var RuntimeUtil = &runtimeUtil{}

type runtimeUtil struct {
}

// 读取程序文件所在的绝对路径。
func (x *runtimeUtil) GetExecPath() string {
	dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
	if err != nil {
		panic(err)
	}

	return strings.Replace(dir, "\\", "/", -1)
}

// 读取程序工作路径。
func (x *runtimeUtil) GetWorkPath() (path string) {
	path, _ = os.Getwd()
	path = strings.Replace(path, "\\", "/", -1)
	return path
}
